package com.hk.chathouse

import android.os.Build
import android.util.Log
import com.example.chathouse.AppShortCutUtil
import io.flutter.embedding.android.FlutterActivity
import io.flutter.embedding.engine.FlutterEngine
import io.flutter.plugin.common.MethodChannel
import io.flutter.plugins.GeneratedPluginRegistrant
import java.util.*

class MainActivity : FlutterActivity() {

    override fun configureFlutterEngine(flutterEngine: FlutterEngine) {
        GeneratedPluginRegistrant.registerWith(flutterEngine)
        MethodChannel(flutterEngine.dartExecutor.binaryMessenger, "chathouse.flutter")
            .setMethodCallHandler { call, result ->
                if (call.method == "getBadge") {
                    val arguments: Map<String, Objects> = call.arguments as Map<String, Objects>;
                    val toString = arguments["badgeNum"].toString()
                    val toInt = toString.toInt();
                    //设置角标
                    AppShortCutUtil.setCount(toInt, this.applicationContext);
                } else {
                    Log.d("BRAND", Build.BRAND)
                }
            }

//
    }

}
